def hailstone(n: int):
    length = 1
    seq = [n]

    while n > 1:
        n = 3 * n + 1 if n % 2 else n / 2
        n = int(n)
        seq.append(n)
        length += 1

    print("操作次数为：", length)
    print("序列为：", seq)


hailstone(27)
